package DesignPatern.A13_适配器模式.QSB.A03_高级模式;

import java.util.Map;

/**
 * @Author: Du
 * @Date: 2021/8/1 14:19
 */
public class OuterUserInfo implements IUserInfo
{
    private IOuterUserBaseInfo iOuterUserBaseInfo;
    private IOuterUserHomeInfo iOuterUserHomeInfo;
    private IOuterUserOfficeInfo iOuterUserOfficeInfo;
    
    private Map baseMap = null;
    private Map homeMap = null;
    private Map officeMap = null;
    
    public OuterUserInfo(IOuterUserBaseInfo iOuterUserBaseInfo, IOuterUserHomeInfo iOuterUserHomeInfo, IOuterUserOfficeInfo iOuterUserOfficeInfo)
    {
        this.iOuterUserBaseInfo = iOuterUserBaseInfo;
        this.iOuterUserHomeInfo = iOuterUserHomeInfo;
        this.iOuterUserOfficeInfo = iOuterUserOfficeInfo;
        
        this.baseMap = this.iOuterUserBaseInfo.getUserBaseInfo();
        this.homeMap = this.iOuterUserHomeInfo.getUserHomeInfo();
        this.officeMap = this.iOuterUserOfficeInfo.getUserOfficeInfo();
    }
    
    @Override
    public String getUserName()
    {
        return (String) this.baseMap.get("userName");
    }
    
    @Override
    public String getHomeAddress()
    {
        return (String) this.homeMap.get("homeAddress");
    }
    
    @Override
    public String getMobileNumber()
    {
        return (String) this.officeMap.get("OfficeNumber");
    }
    
    @Override
    public String getJobPosition()
    {
        return (String) this.officeMap.get("jobPosition");
    }
    
    @Override
    public String getHomeTelNumber()
    {
        return (String) this.homeMap.get("homeTelNumber");
    }
}
